{template 'common/header'}

<ul class="nav nav-tabs">
        <li>
        	<a href="{php echo $this->createWebUrl('region', array('op' => 'list'));}">小区管理</a>
        </li>
        
        <li {if $op == 'add'}class="active" {/if}>
        	<a href="{php echo $this->createWebUrl('region', array('op' => 'add'));}">{if $_GPC['id']}修改小区{else}新增小区{/if}</a>
        </li>
      
        
    </ul>
    <form action="" class="form-horizontal form" method="post" role="form" enctype="multipart/form-data" onsubmit="return check(this);">
        <input type="hidden" name="id" value="{$item['id']}">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">小区信息</h3>
          </div>
          <div class="panel-body">
            <div class="form-group">
                <label for="title" class="col-sm-2 control-label">小区名称</label>
                <div class="col-sm-4">
                  <input type='text' name='title' id='title' class="form-control" value="{$item['title']}" placeHolder="请输入小区名称"/>
                </div>
            </div>
            <div class="form-group">
                <label for="linkmen" class="col-sm-2 control-label">联系人</label>
                <div class="col-sm-5">
                  <input type='text' name='linkmen' id='linkmen' class="form-control" value="{$item['linkmen']}" placeHolder="请输入联系人"/>
                </div>
            </div>
            <div class="form-group">
                <label for="linkway" class="col-sm-2 control-label">联系电话</label>
                <div class="col-sm-5">
                  <input type='text' name='linkway' class="form-control" id='linkway' value="{$item['linkway']}" placeHolder="请输入联系电话"/>
                </div>
            </div>
            <div class="form-group">
                <label for="qq" class="col-sm-2 control-label">联系QQ</label>
                <div class="col-sm-5">
                  <input type='text' name='qq' class="form-control" id='qq' value="{$item['qq']}" placeHolder="此处QQ为我的小区里面的客服QQ"/>
                </div>
            </div>
            <div class="form-group">
                <label for="linkway" class="col-sm-2 control-label">小区图片</label>
                <div class="col-sm-5">
                  {php echo tpl_form_field_image('thumb', $item['thumb'])}
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 地址</label>
                <div class="col-sm-8 col-xs-12">
                    {php echo tpl_form_field_district('reside',array('province' => $item['province'],'city' => $item['city'],'district' => $item['dist']));}
                </div>
            </div>
            <div class="form-group">
                <label for="linkway" class="col-sm-2 control-label">详细地址</label>
                <div class="col-sm-5">
                  <input type='text' name='address' class="form-control" id='address' value="{$item['address']}" placeHolder="请输入小区地址"/>
                </div>
            </div>
            <div class="form-group">
                <label for="linkway" class="col-sm-2 control-label">坐标</label>
                <div class="col-sm-5">
                  {php echo tpl_form_field_coordinate('baidumap', $item)}
                </div>
            </div>
            
            <div class="form-group">
                <label for="linkway" class="col-sm-2 control-label">外部链接</label>
                <div class="col-sm-5">
                  {php echo tpl_form_field_link('url',$item['url'])}
                </div>
            </div>

            <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                    <div class="col-sm-9 col-xs-12 help-block">如需要链接到外部网站,请在此设置网址。</div>
                </div>
            <div class="form-group">
                <label for="" class="col-sm-2 control-label"></label>
                <div class="col-sm-5">
                   <button type="submit" class="btn btn-primary span3" name="submit" value="提交">提交</button>
                    <input type="hidden" name="token" value="{$_W['token']}" />
                </div>
            </div>
          </div>
        </div>

    </form>
    <script type="text/javascript">
        function check(form){
                if (!form['title'].value) {
                    alert('请输入小区名称。');
                    return false;
                }
                if (!form['linkway'].value) {
                    alert('请输入正确的电话号码！');
                    return false;
                }
                if (!form['linkmen'].value) {
                    alert('请输入联系人姓名。');
                    return false;
                }
                if (!form['address'].value) {
                    alert('请输入小区地址。');
                    return false;
                }
                if (!form['qq'].value) {
                    alert('请输入联系QQ,必填。');
                    return false;
                }
                return true;
        }
    </script>

{template 'common/footer'}